Imports System.Web.UI.WebControls
Imports System.Web.UI
Imports DotNetNuke.UI.Utilities


Namespace DotNetNuke.UI.WebControls
    Public Class BaseWebControl : Inherits WebControl

        Public Shared Sub RegisterInitialize(ByVal ctl As Control, ByVal func As String, ByVal propJson As String)
            'instead of sending down variables directly into the __DNNVariable, we need to do it through script
            'so the stupid UpdatePanel will work
            Dim script As String = String.Format("dnn.setVar('{0}_p', '{1}');", ctl.ClientID, ClientAPI.EscapeForJavascript(propJson))
            ClientAPI.RegisterStartUpScript(ctl.Page, ctl.ClientID & "_startup", String.Format("<script type=""text/javascript"">{0}dnn.controls.{1}($get('{2}'));</script>", script, func, ctl.ClientID))
        End Sub

    End Class
End Namespace